//
//  TodaysSaleViewController.m
//  BeiBei
//
//  Created by apple on 16/7/28.
//  Copyright © 2016年 XiaoYu. All rights reserved.
//

#import "TodaysSaleViewController.h"
//#import <AFNetworking/AFNetworking.h>


@interface TodaysSaleViewController ()

@end

@implementation TodaysSaleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    
    [self addView:self.view leftBut:Left_But_View rightBut:Right_But_View titleView:TodaysSale_Title_View dataArray:TodaysSale_DataArray];
    
    [self createBgCollectionView:self.view];
 
    
    
    AFHTTPSessionManager * manager = [NetTool getSessionManager];

//    AFHTTPSessionManager * manager = [AFHTTPSessionManager manager];
    
    if (manager)
    {
        
        [manager GET:URLStr_One parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
            
            
//            NSLog(@"-----%@",[[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]);
            
            NSDictionary * dic =[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
            
            NSArray * adsArray = dic[@"ads"];
            
            [self createsmallScrollView:adsArray];
            
            [self createPageControl:adsArray];
            
            [self createTimer:2];
            
            NSArray * iconArray = dic[@"icon_shortcuts"];
            
            [self createIcon:iconArray titKey:@"title" imgKey:@"img"];
//            NSLog(@">>>%d",iconArray.count);
            
            
            
            
            
        } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
            
        }];
          
    }
    
   
    
    
    
}
-(void)addLeftBut
{
    NSLog(@"重写了左按键");
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
